import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'normalize.css'
import Vant from 'vant';
import 'vant/lib/index.css';
import { Capacitor } from '@capacitor/core';
import { uploadToken, uploadInstantIdUrl, uploadInstallReferrer } from './api'
import { jiami, jiemi } from "./utils/aeskey";
Vue.prototype.$capacitor = Capacitor;
const res = {
    GAID: "7d34badb-026e-4c87-90f3-8b7a0b07b0e7",
    AID: "7bfc1650648907b3",
    RV: "1.0",
    VERSION: "1.0.0",
}
Vue.use(Vant)
Vue.config.productionTip = false
window.updateData = async function(item) {
    if (item && item.type == 1 && item.token) {
        const result = await uploadToken(jiami({ model: item.token || null }))
        console.log(item.token, '谷歌token')
            // console.log(JSON.stringify(jiemi(result.data)), '上报谷歌token')
        console.log(result, '上报谷歌token')
    }
    if (item && item.type == 2 && item.id) {
        const result = await uploadInstantIdUrl(jiami({ model: item.id || null }))
        console.log(item.id, '第二个id')
            // console.log(JSON.stringify(jiemi(result.data)), '上报InstanceId')
        console.log(result, '上报InstanceId')
    }
    if (item && item.type == 3) {
        console.log(JSON.stringify(item), '第三个id')
        const result = await uploadInstallReferrer(jiami({ model: item || {} }))

        // console.log(JSON.stringify(jiemi(result.data)), '上报InstallReferrer')
        console.log(result, '上报InstallReferrer')
    }
}



new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')